﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HeartLess.Managers;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace HeartLess.Components
{
    public class ShockWaveGun : IWeapon
    {
        private bool _isFiring;
        private ShockWave _currentShockWave;

        public void Update(GameTime gameTime)
        {
            if (_isFiring)
            {
                _currentShockWave.Update(gameTime);
            }
        }

        public void Fire(Vector2 location)
        {
            if (_isFiring) return;

            _isFiring = true;
            _currentShockWave = new ShockWave(location, this);
            ShaderManager.addShaderDrawer(_currentShockWave);
        }

        public void onFireDone()
        {
            _isFiring = false;
            ShaderManager.removeShaderDrawer(_currentShockWave);
            _currentShockWave = null;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            if (_isFiring)
            {
                _currentShockWave.Draw(spriteBatch);
            }
        }

    }
}
